//
//  WFGuanZhuViewController.m
//  WangyiFangzuo
//
//  Created by 瑜 on 16/9/12.
//  Copyright © 2016年 111. All rights reserved.
//

#import "WFGuanZhuViewController.h"
#import "WFView.h"
#import "WFGuanZhuTableViewCell.h"
@interface WFGuanZhuViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UIView *sectionView;
@property(nonatomic,strong)UITableView *tableView;
@end

@implementation WFGuanZhuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    _tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.rowHeight = 80;
    [self.view addSubview:_tableView];
}

- (void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    WFView *view = [[[NSBundle mainBundle] loadNibNamed:@"WFView" owner:nil options:nil] lastObject];
    view.frame = CGRectMake(0, 0, self.tableView.frame.size.width, self.tableView.frame.size.height*0.25);
    _tableView.tableHeaderView = view;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *ID = @"cell";
    WFGuanZhuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(!cell)
    {
        cell = [WFGuanZhuTableViewCell cell];
    }
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 40;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    if(section == 0)
    {
        return @"大家都在看";
    }
    else
    {
        return @"大家都在问";
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
